package Array;

public class item11 {
    public static int maxArea(int[] height) {
        int max= 0 ;
        for(int i = 0 ;i<height.length;i++)
        {
           int  temp = height[i];
            for(int j = height.length-1;j>=i;j--)
            {
                if(temp<=height[j])
                {
                    if( max < (j-i)*height[i])
                    {
                        max = (j-i)*height[i];
                    }
                }
                if(temp>height[j])
                {
                    if(max<(j-i)*height[j])
                    {
                        max = (j-i)*height[j];
                    }
                }
            }

        }
        return max;
    }

    public static void main(String[] args) {
        int [] num = {2,3,4,5,18,17,6};
        int i = maxArea(num);
        System.out.println(i);
    }
}
